<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script type="text/javascript" src="scripts/boot.js"></script>
<style type="text/css">
	.item{
		width: 95px;
		display: inline-block;
		margin-left: 5px;
	}
</style>
</head>
<body style="border: 0px; margin: 0px; padding: 0px;width: 100%;height: 100%">
<div class="mini-toolbar" style="border-bottom:0;padding:0px;">
<div id="splitter1" class="mini-splitter" vertical="true" style="width:100%;height: 70px;">
   	<div class="splitterDiv" style="border: none;">
   		<table style="width:100%;">
	        <tr>
	        	<td style="width:30%;">
	        		<span class="item">出库单编号：</span>
	                <input id="serialNum" emptyText="请输入出库单编号" class="mini-textbox" style="width:160px;" />
	        	</td>
	        	<td style="width:30%;">
	        		<span class="item">标题(模糊)：</span>
	                <input id="stitle" emptyText="请输入标题" class="mini-textbox" style="width:160px;" />
	        	</td>	   
	            <td style="width:30%;">
	            	<span class="item">仓库名称(模糊)：</span>
	                <input id="warehouseName" emptyText="请输入仓库名称" class="mini-textbox" style="width:160px;" />
	            </td>
	            <td style="display: inline-block;"><a class="mini-button" iconCls="icon-search" onclick="search()">查询</a></td>
	        </tr>
	        <tr>
	            <td>
	            	<span class="item">药品编号：</span>
	                <input id="medicineNo" emptyText="请输入药品编号" class="mini-textbox" style="width:160px;" />
	            </td>
	            <td>
	            	<span class="item">药品名称(模糊)：</span>
	                <input id="medicineName" emptyText="请输入药品名称" class="mini-textbox" style="width:160px;" />
	            </td>
	            <td>&nbsp;</td>
	            <td style="display: inline-block;"><a href="javascript:showHq();">更多</a></td>
	        </tr>
	    </table>
   	</div>
   	<div visible="false" class="splitterDiv" style="border: none;">
    	<table style="width:100%;">
	        <tr>
	           	<td style="width:30%;">
	                <span class="item">出库时间(开始)：</span>
	                <input id="startTime" emptyText="请选择..." class="mini-datepicker" style="width: 160px" allowInput="false"/>
	            </td>
	            <td style="width:30%;">
	            	<span class="item">出库时间(结束)：</span>
	                <input id="endTime" emptyText="请选择..." class="mini-datepicker" style="width: 160px" allowInput="false"/>
	            </td>
	            <td style="width:30%;">
	            	&nbsp;
	            </td>
	            <td style="display: inline-block;"><a href="javascript:hideHq();">收起</a></td>
	        </tr>
	    </table>
	</div>
   </div>
</div>
<div class="mini-fit" >
<div id="datagrid1" class="mini-datagrid " idField="id" pageSize="20" showSummaryRow="true"
	url="statistics_recall_page.do"
	ondrawsummarycell="onDrawSummaryCell"
	style="width:100%;height:100%;">
	<div property="columns">
			<div type="indexcolumn"></div>
			<div field="serialNum" width="100" align="center" align="center" headerAlign="center" >出库单编号</div>
			<div field="title" width="110" align="center" headerAlign="center">标题</div>
			<div field="warehouse" width="100" align="center" headerAlign="center" >仓库</div>
			<div field="recallTime" width="80" align="center" allowSort="true" headerAlign="center" >出库时间</div>
			<div field="rType" width="90" align="center" headerAlign="center" >出库类型</div>
			<div field="medicineSerialNum" width="100" align="center" headerAlign="center" >药品编号</div>
			<div field="medicineName" width="110" align="center" headerAlign="center" >药品名称</div>
			<div field="medicineUnit" width="50" align="center" headerAlign="center" >单位</div>
			<div field="quantity" width="100" align="center" headerAlign="center" >出库量</div>
		</div>
</div>
</div>
<script type="text/javascript">

mini.parse();

var grid = mini.get("datagrid1");
grid.load();

function search() {
	var serialNum = mini.get("serialNum").getValue();
    var title = mini.get("stitle").getValue();
    var startTime = mini.get("startTime").getFormValue();
    var endTime = mini.get("endTime").getFormValue();
    var warehouseName = mini.get("warehouseName").getValue();
    var medicineNo = mini.get("medicineNo").getValue();
    var medicineName = mini.get("medicineName").getValue();
    grid.load({
    	warehouseName: warehouseName,
    	medicineName: medicineName,
    	serialNum: serialNum,
    	title: title,
    	startTime: startTime,
    	endTime: endTime,
    	medicineSerialNum: medicineNo
    });
}

function onDrawSummaryCell(e) {
    var rows = e.data;
    
    if (e.field == "quantity") {
        var total = 0;
        for (var i = 0 ; i < rows.length; i++) {
            var row = rows[i];
            total += row.quantity;
        }

        e.cellHtml = "总出库量: " + total;
    }
}

function showHq(){
	var splitter1 = mini.get("splitter1");
	$("#splitter1").css("height","120px");
	splitter1.showPane("2");
}

function hideHq(){
	var splitter1 = mini.get("splitter1");
	$("#splitter1").css("height","70px");
	splitter1.hidePane("2");
}
</script>
</body>
</html>